#include "usermsform.h"
#include "ui_usermsform.h"
#include <QSqlQueryModel>
#include <QDebug>

UserMSForm::UserMSForm(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::UserMSForm)
{
    ui->setupUi(this);

    m_usrInfoModel = new QSqlQueryModel(this);
    updateUsrView();
}

UserMSForm::~UserMSForm()
{
    delete ui;
}

void UserMSForm::updateUsrView(void)
{
    m_usrInfoModel->clear();
    m_usrInfoModel->setQuery("select * from usr_info");
    m_usrInfoModel->setHeaderData(0, Qt::Horizontal, tr("账号"));
    m_usrInfoModel->setHeaderData(1, Qt::Horizontal, tr("昵称"));
    m_usrInfoModel->setHeaderData(2, Qt::Horizontal, tr("密码"));
    m_usrInfoModel->setHeaderData(3, Qt::Horizontal, tr("角色"));

    ui->tableView->setModel(m_usrInfoModel);
}
